---
title: Adding compiler sources
description: Module resolution in bud.js
slug: compiler-sources
sidebar_label: Adding compiler sources
sidebar_position: 5
---

import ConfigExample from '@site/src/components/example';

By default, **bud.js** only resolves source code from [the `@src` directory](/reference/bud.path).

Nearly all of the modules you install will have been compiled before they are published. It's almost always a waste to run this code through Babel or whatever other compiler you may be using.

Nevertheless, some packages expect to be compiled from source. We can allow for this with the **bud.build.rules** API.

Common examples:

- [highlight.js](https://npmjs.org/package/highlight.js)
- [swiper](https://npmjs.org/package/swiper)
- various scss frameworks
- a project that needs to source modules from multiple directories

## Adding sources

Use [bud.compilePaths](/reference/bud.compilePaths) to add additional directories to the list of sources that will be compiled.

As a quick example, let's say we have a project that needs to source modules from the swiper package.:

<ConfigExample>

```ts title=bud.config.ts
bud.compilePaths([
  bud.path(`@src`),
  bud.path(`@modules/swiper`)
])
```

```js title=bud.config.js
bud.compilePaths([
  bud.path(`@src`),
  bud.path(`@modules/swiper`)
])
```

```yml title=bud.config.yml
compilePaths:
  - ['src', 'node_modules/swiper']
```

```json title=bud.config.json
{
  "compilePaths": [
    ["src", "node_modules/swiper"]
  ]
}
```

</ConfigExample>
